$(document).ready(function () {
	cktslcx.onLoad();
})

var cktslcx = (function () {
	var init = function () {
		//私有属性
		var curSeg;
		layui.use('form', function () {
			var form = layui.form
		});
	}
	return {
		onLoad: function () {
			init();
		},
		/*查询*/
		onQuery: function () {
			var hgspm = $(".hgspm").val().trim();
			var spmc = $(".spmc").val().trim();
			if (hgspm != "" &&  spmc !="") {
				$.ajax({
					url: queryHtp+"/bsfwt/sscx/getBSFW_SSCX.do",
					type: "GET",
					data: {
						CXLB:"CKTSLCX",
						CODE:hgspm,
						NAME:spmc,
						NSRMC:""
					},
					dataType: "jsonp",
					jsonpCallback: "cktslcx.onqueryCallback",
				});
			} else if(hgspm==""){
				layer.msg('海关商品码不能为空');
			}else if(spmc==""){
				layer.msg('商品名称不能为空');
			}
		},
		onqueryCallback: function (jsonObj) {
            if(jsonObj.data==""){
            	layer.msg(jsonObj.msg);
            }else{
            	if ( $.fn.dataTable.isDataTable( '#wxlCktslcx' ) ) {
            		var table = $('#wxlCktslcx').DataTable();
            		table.destroy();
            	}
            	$('#wxlCktslcx').DataTable({
            		"data": jsonObj.data,
            		"columns": [{
            				"data": "CODE"
            			},
            			{
            				"data": "NAME"
            			},
            			{
            				"data": "BCFLAG"
            			},
            			{
            				"data": "SZ"
            			},
            			{
            				"data": "ZSSL_SET"
            			},
            			{
            				"data": "CLDE"
            			},
            			{
            				"data": "CLDL"
            			},
            			{
            				"data": "TSL"
            			},
            			{
            				"data": "ST_DATE"
            			},
            			{
            				"data": "END_DATE"
            			}
            		],
            		"ordering": false,
            		"info": false,
            		"lengthChange": false,
            		"searching": false
            	})
            }
		},
		winReset: function () {
			var nsrsbh = $(".wxl_cxSearch input").val("");
			$("#wxlCktslcx tbody").empty()
		},
		

	}
})();
